﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="File.aspx.cs" Inherits="File" EnableEventValidation="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="CSS/File.css" rel="stylesheet" type="text/css" />
        <script src="../JavaScript/ajax.js" type="text/javascript"></script>
    <title>.: Quan ly file :.</title>

    <script language="javascript" type="text/javascript">
    function Check_DropList()
    {
        if(document.getElementById("drListGroup").value != "")       
        return true;         
        alert("Bạn chưa chọn nhóm để lưu");
        return false;
    }
    function CheckSelected()
    {      
        if(document.getElementById("drDirectory").value != "")
        return true;         
        alert("Bạn chưa chọn thư mục để lưu");
        return false;
    }
    function DisplayHelp(id)
    {
    if(document.getElementById(id).style.display=="none")
        document.getElementById(id).style.display="block";
    else
        document.getElementById(id).style.display="none";
    }
    </script>

</head>
<body topmargin="0" class="bgUploadFile">
    <form id="form2" runat="server" enctype="multipart/form-data">
    <center>
        <table cellpadding="1" cellspacing="1" style="width: 800px" border="0" align="center">
            <tr>
                <td class="fontNomal" style="width: 150px; height: 26px; text-align: left;
                    border: solid 1px green;">
                    <img src="Images/icon_profile_16px.gif" />
                    Quản lý file: &nbsp;&nbsp;
                </td>
                <td class="fontNomal" style="border-right: green 1px solid; border-top: green 1px solid;
                    border-left: green 1px solid; border-bottom: green 1px solid; height: 26px;
                    text-align: left">
                    Thư mục:
                    <asp:TextBox ID="txtCurrentPath" runat="server" BackColor="ControlLightLight" BorderStyle="Solid"
                        BorderWidth="1px" Font-Bold="True" Font-Size="10pt" ForeColor="RoyalBlue" Height="50px"
                        ReadOnly="True" Width="400px" TextMode="MultiLine">/</asp:TextBox>&nbsp;
                        <asp:Button ID="btnSavePath" Text="Save đường dẫn hình" runat="server" onclick="btnSavePath_Click"></asp:Button> 
                </td>               
            </tr>
            <tr>
                <%-- <td class="fontNomal tita" colspan="2" style="border-right: green 1px solid; border-top: green 1px solid;--%>
                <td class="fontNomal" style="border-right: green 1px solid; border-top: green 1px solid;
                    border-left: green 1px solid; width: 500px; border-bottom: green 1px solid; height: 26px;
                    text-align:right">
                    Tải lên:
                    
                </td>
                <td class="fontNomal tita borderTableFile"style="text-align:left">
                    <asp:FileUpload ID="FileUpload" runat="server" CssClass="cursorHand" />
                    <asp:ImageButton ID="imgBtUploadFile" runat="server" CausesValidation="False" ImageUrl="Images/action_top.gif"
                        OnClick="imgBtUploadFile_Click" ToolTip="Tải file lên" />
                    <img class="cursorHand" onclick="DisplayHelp('helpFolder')" src="Images/action_help.gif"
                        title="Chọn để lưu tập tin phải phù hợp với từng loại tập tin: Thư mục Image (jpg, gif,png ...); Flash (swf)." />
                    <asp:CheckBox ID="cbOverWrite" runat="server" Text="Ghi đè" /><asp:Label ID="lbMsg" runat="server" ForeColor="Red" CssClass="fontNomal tita"></asp:Label>
                        <asp:Label runat="server" ID="lbmesage1"></asp:Label>
                </td>
            </tr>
            <tr>
                <td style="width: 200px;" class="fontNomal borderTableFile">
                    <asp:ImageButton ID="imgBtFolderUp" runat="server" CausesValidation="False" ImageUrl="Images/folderup.gif"
                        OnClick="imgBtFolderUp_Click" ToolTip="Click về thư mục trước" />
                    Các thư mục:&nbsp; <asp:Button ID="btnSavePath0" Text="Refresh" 
                        runat="server" onclick="Refresh" Width="108px"></asp:Button>
                </td>
                <td class="fontNomal borderTableFile" style="width: 300px;">
                    Thư mục mới:
                    <asp:TextBox ID="txtNewDirectory" runat="server" Width="162px" MaxLength="100"></asp:TextBox>&nbsp;
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtNewDirectory"
                        ErrorMessage="*" ValidationGroup="CreateFolder"></asp:RequiredFieldValidator>
                    <asp:ImageButton ID="imgBtAddNewDir" runat="server" ImageUrl="Images/add.gif"
                        OnClick="imgBtAddNewDir_Click" ValidationGroup="CreateFolder" ToolTip="Thêm thư mục mới" />
                </td>
            </tr>
            <tr>
                <td class="borderTableFile" style="width: 150px; vertical-align: top">
                    <div style="width: 200px; text-align: left; height: 500px; overflow: scroll;">
                        <asp:TreeView ID="TreeView1" runat="server" Width="194px" CollapseImageUrl="Images/bullet1.gif" ExpandDepth="0"
                            ExpandImageUrl="Images/bullet2.gif" NoExpandImageUrl="Images/bullet1.gif" 
                            onselectednodechanged="TreeView1_SelectedNodeChanged">
                            <ParentNodeStyle ChildNodesPadding="2px" />
                            <RootNodeStyle ChildNodesPadding="2px" />
                            <NodeStyle ChildNodesPadding="2px" />
                            <LeafNodeStyle HorizontalPadding="2px" NodeSpacing="2px" />
                        </asp:TreeView>
                    </div>
                </td>
                <td class="borderTableFile" style="width: 450px; height: 400px">
                    <div style="width: 732px; text-align: left; height: 500px; overflow: scroll;">
                        <asp:DataList ID="dtlFile" runat="server" OnDeleteCommand="dtlFile_DeleteCommand">
                            <HeaderTemplate>
                                <div style="float: left; width: 600px">
                                    <div style="float: left; width: 300px">
                                        FileName
                                    </div>
                                    <div style="float: left; width: 80px">
                                        Size
                                    </div>
                                    <div style="float: left; width: 200px">
                                        DateCreate
                                    </div>
                                    <div style="float: left; width: 20px; height: 5px">
                                    </div>
                                </div>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <div class="ShowFile">
                                    <div style="float: left; width: 300px">
                                        <a title="Click để lấy link file" href="javascript:void(0);" onclick="UploadHinh('<%=this.idtxt%>', '<%=this.idimg%>', 'FileUpload<%#DataBinder.Eval(Container.DataItem,"Url")%>');">
                                            <%#DataBinder.Eval(Container.DataItem, "ShowFileDetail")%><%#Eval("FileName")%>
                                        </a>
                                    </div>
                                    <div style="float: left; width: 80px">
                                        <%#Eval("Size")%>
                                    </div>
                                    <div style="float: left; width: 200px">
                                        <%#Eval("DateModified")%>
                                    </div>
                                    <div style="float: left; width: 20px;">
                                        <asp:ImageButton ID="imbtnDelete" runat="server" ImageUrl="Images/ico_delete.gif"
                                            CommandArgument='<%#Eval("Url")%>' CommandName="Delete" OnClientClick="return confirm('Are you sure delete this ?');" />
                                    </div>
                                </div>
                            </ItemTemplate>

                        </asp:DataList>
                        <asp:DataList ID="dlDerectory" runat="server" OnDeleteCommand="dlDerectory_DeleteCommand">
                            <HeaderTemplate>
                                <div style="float: left; width: 600px">
                                    <div style="float: left; width: 300px">
                                        FileName
                                    </div>
                                    <div style="float: left; width: 80px">
                                        Size
                                    </div>
                                    <div style="float: left; width: 200px">
                                        DateCreate
                                    </div>
                                    <div style="float: left; width: 20px; height: 5px">
                                    </div>
                                </div>
                            </HeaderTemplate>
                            <ItemTemplate>
                                <div class="ShowFile">
                                    <div style="float: left; width: 300px">
                                        <a title="Click để lấy link file" href="javascript:void(0);" onclick="UploadHinh('<%=this.idtxt%>', '<%=this.idimg%>', 'FileUpload<%#DataBinder.Eval(Container.DataItem,"Url")%>');">
                                            <%#DataBinder.Eval(Container.DataItem, "ShowFileDetail")%><%#Eval("FileName")%>
                                        </a>
                                    </div>
                                    <div style="float: left; width: 80px">
                                        <%#Eval("Size")%>
                                    </div>
                                    <div style="float: left; width: 200px">
                                        <%#Eval("DateModified")%>
                                    </div>
                                    <div style="float: left; width: 20px;">
                                        <asp:ImageButton ID="imbtnDelete" runat="server" ImageUrl="Images/ico_delete.gif"
                                            CommandArgument='<%#Eval("Url")%>' CommandName="Delete" OnClientClick="return confirm('Are you sure delete this ?');" />
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:DataList>
                    </div>
                </td>
            </tr>
        </table>
    </center>
    </form>
</body>
</html>
